package com.lmh.friend.controller.question;

import com.lmh.common.core.domain.R;
import com.lmh.common.core.domain.TableDataInfo;
import com.lmh.friend.domain.question.dto.QuestionQueryDTO;
import com.lmh.friend.domain.question.vo.QuestionDetailVO;
import com.lmh.friend.domain.question.vo.QuestionVO;
import com.lmh.friend.service.question.IQuestionService;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/question")
public class QuestionController {
    @Autowired
    private IQuestionService questionService;

    @GetMapping("/semiLogin/list")
    public TableDataInfo list(QuestionQueryDTO questionQueryDTO) {
        return questionService.list(questionQueryDTO);
    }

    @GetMapping("/detail")
    public R<QuestionDetailVO> detail(Long questionId) {
        return R.ok(questionService.detail(questionId));
    }

    /**
     * 这个方法只需要返回当前题目的前一题的questionId就可以了
     * @param questionId
     * @return
     */
    @GetMapping("/preQuestion")
    public R<String> preQuestion(Long questionId) {
        return R.ok(questionService.preQuestion(questionId));
    }

    @GetMapping("/nextQuestion")
    public R<String> nextQuestion(Long questionId) {
        return R.ok(questionService.nextQuestion(questionId));
    }

    @GetMapping("/semiLogin/hotList")
    public R<List<QuestionVO>> getHotQuestionList() {
        return R.ok(questionService.getHotQuestionList());
    }
}
